import axios, {ResponseData} from 'yuxin-base/src/utils/axios'

export default {
	/**
	 * 新增小区
	 * @param data
	 */
	addCommunity(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/add_community',
			data,
			method: 'POST'
		})
	},
	/**
	 * 删除项目
	 * @param id 项目id
	 */
	removeCommunity(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/community/remove/${id}`,
			method: 'DELETE'
		})
	},
	/**
	 * 获取小区列表（排除空房源小区）
	 * @param data {containHouse:true|false是否包含房源, type:小区类型【1、分散式 2、集中式 0所有】	}
	 */
	getHouseCommunityList(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/house/communitys',
			method: 'POST'
		})
	},
	/**
	 * 获取小区列表（包含楼栋列表、楼层列表、房型列表）
	 * @param data
	 */
	getHouseCommunityFloorList(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/house/community_building_floors',
			method: 'POST'
		})
	},
	/**
	 * 获取集中式部门小区
	 *
	 */
	getCentralizedCommunity(): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/centralized_department_community',
			method: 'GET'
		})
	},
	/**
	 * 获取分散式部门小区
	 *
	 */
	getDecentralizedCommunity(): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/decentralized_department_community',
			method: 'GET'
		})
	},
	/**
	 * 获取可过滤集中式部门小区 list
	 *
	 */
	getCentralizedCommunityList(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/house/centralized_community',
			method: 'POST'
		})
	},
	/**
	 * 获取小区列表
	 * @param data
	 */
	getCommunityList(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house/list_community',
			data,
			method: 'POST'
		})
	},
	/**
	 * 新增集中式项目基本信息
	 * @param data
	 */
	addProjectBasicInfo(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/add_project_basic_info',
			data,
			method: 'POST'
		})
	},
	/**
	 * 更新集中式项目基本信息
	 * @param data
	 */
	updateProjectBasicInfo(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/update_project_basic_info',
			data,
			method: 'POST'
		})
	},
	/**
	 * 获取集中式项目基本信息
	 * @param communityId
	 */
	getProjectBasicInfo(communityId: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/project_basic_info/${communityId}`,
			method: 'GET'
		})
	},
	/**
	 * 获取集中式项目扩展信息
	 * @param communityId
	 */
	getProjectExtraInfo(communityId: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/project_extend_info/${communityId}`,
			method: 'GET'
		})
	},
	/**
	 * 保存集中式项目扩展信息
	 * @param data
	 */
	saveProjectExtraInfo(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/add_project_extend_info',
			method: 'POST'
		})
	},
	/**
	 * 获取集中式楼栋房间列表(配置房间使用)
	 * @param buildingId
	 */
	getBuildingRoomList(buildingId: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/list_floor_house_room/${buildingId}`,
			method: 'GET'
		})
	},
	/**
	 * 楼盘房间统一配置(配置房间使用)
	 * @param data
	 */
	saveBatchRoomConfig(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/room_unified_config',
			method: 'POST'
		})
	},
	/**
	 * 批量删除房间
	 * @param ids
	 */
	batchRemoveRooms(ids: string[]): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/rooms_remove?ids=' + ids.join(),
			method: 'DELETE'
		})
	},
	/**
	 * 批量启用、禁用房间(配置房间使用)
	 * @param data
	 */
	batchEnableOrDisableRooms(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/admin/house_room/room_enable_disable',
			method: 'POST'
		})
	},
	/**
	 * 根据项目id获取楼栋列表
	 * @param communityId
	 */
	getBuildingList(communityId: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/list_building',
			method: 'GET',
			params: {
				communityId
			}
		})
	},
	/**
	 * 删除楼栋
	 * @param id
	 */
	removeBuilding(id: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/remove_building',
			method: 'POST',
			params: {
				id
			}
		})
	},
	/**
	 * 根据项目id获取房型列表
	 * @param communityId
	 */
	getRoomTypeList(communityId: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/list_room_type/${communityId}`,
			method: 'GET'
		})
	},
	/**
	 * 创建房型
	 * @param data
	 */
	createRoomType(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/create_room_type',
			method: 'POST'
		})
	},
	/**
	 * 更新房型
	 * @param data
	 */
	updateRoomType(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/update_room_type',
			method: 'POST'
		})
	},
	/**
	 * 删除房型
	 * @param id
	 */
	removeRoomType(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/remove_room_type/${id}`,
			method: 'POST'
		})
	},
	/**
	 * 新增房间（集中式）
	 * @param data
	 */
	addRoom(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/add_building_house_room',
			method: 'POST'
		})
	},
	/**
	 * 删除房间（集中式）
	 * @param id
	 */
	removeRoom(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/room_remove/${id}`,
			method: 'DELETE'
		})
	},
	/**
	 * 更新房间号
	 * @param data
	 */
	saveRoomName(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/room_name',
			method: 'PUT'
		})
	},
	/**
	 * 更新集中式房间基本信息
	 * @param data
	 */
	updateRoomBaseInfo(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/centralized/update_building_house_room_simple_Info',
			method: 'POST'
		})
	},
	/**
	 * 获取分散式房源列表
	 * @param data
	 */
	getDistributedHouseList(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/decentralized_house_diagram',
			data,
			method: 'POST'
		})
	},
	/**
	 * 获取分散式房源统计
	 * @param data
	 */
	getDistributedHouseState(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/decentralized_house_diagram_state',
			data,
			method: 'POST'
		})
	},
	/**
	 * 获取集中式房源列表
	 * @param data
	 */
	getCentralizedHouseList(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/centralized_house_diagram',
			data,
			method: 'POST'
		})
	},
	/**
	 * 集中式楼栋楼层列表
	 * @param data
	 */
	getCentralizedBuilding(id: string): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/centralized_house_diagram_building_floor?buildingId=' + id,
			method: 'GET'
		})
	},
	/**
	 * 获取分散式房源统计
	 * @param data
	 */
	getCentralizedHouseState(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/centralized_house_diagram_state',
			data,
			method: 'POST'
		})
	},
	/**
	 * 查看合租房源房间信息
	 * @param id
	 */
	getSharingHouseInfo(id: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/sharing_house_base_info/' + id,
			method: 'GET'
		})
	},
	/**
	 * 查看整租房源房间信息
	 * @param id
	 */
	getWholeHouseInfo(id: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/whole_house_base_Info/' + id,
			method: 'GET'
		})
	},
	/**
	 * 获取房源基础信息(编辑回显)
	 * @param housePid
	 */
	getHouseBaseInfo(housePid: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house_base/detail/' + housePid,
			method: 'GET'
		})
	},
	/**
	 * 获取房源扩展信息(编辑回显)
	 * @param housePid
	 */
	getHouseExtraInfo(housePid: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/room_extend_info/' + housePid,
			method: 'GET'
		})
	},
	/**
	 * 添加分散式房源基础信息(合租、整租)
	 * @param data
	 */
	addHouseBasicInfo(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/add_basic_info',
			data,
			method: 'POST'
		})
	},
	/**
	 * 更新分散式房源基础信息(合租、整租)
	 * @param data
	 */
	updateHouseBasicInfo(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/update_basic_info',
			data,
			method: 'POST'
		})
	},
	/**
	 * 更新分散式房源扩展信息(合租、整租)
	 * @param data
	 */
	updateHouseExtraInfo(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/update_base_extend_info',
			data,
			method: 'POST'
		})
	},
	/**
	 * 删除房间
	 * @param houseRoomId
	 */
	removeHouseRoom(houseRoomId: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/room_remove/' + houseRoomId,
			method: 'DELETE'
		})
	},
	/**
	 * 删除房源
	 * @param housePid
	 */
	removeHouse(housePid: string): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/decentralized/house_remove/' + housePid,
			method: 'DELETE'
		})
	},

	/**
	 * 获取房间信息
	 * @param houseRoomId
	 */
	getRoomInfo(houseRoomId: string): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house/decentralized/sharing_house_room_view/' + houseRoomId,
			method: 'GET'
		})
	},

	/**
	 * 房源脏房状态
	 * @param data
	 */
	stampHouse(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house_room/stamp_house',
			data,
			method: 'POST'
		})
	},

	/**
	 * 房源配置开关
	 * @param housePid
	 */
	configHouse(houseRoomId: string, type: number): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house_room/config_house_room/' + houseRoomId + '/' + type,
			method: 'GET'
		})
	},

	/**
	 * 锁定房间操作
	 * @param housePid
	 */
	lockHouse(houseRoomId: string, type: number): Promise<ResponseData> {
		return axios.request({
			url: '/house/house_room/lock_house_room/' + houseRoomId + '/' + type,
			method: 'GET'
		})
	},

	/**
	 * 关闭开启房间操作
	 * @param data
	 */
	openOrCloseHouse(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house_room/open_or_close_house',
			data,
			method: 'POST'
		})
	},

	/**
	 * 添加备注
	 * @param data
	 */
	addComment(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/admin/house_room/add_house_room_comment',
			data,
			method: 'POST'
		})
	},
	/**
	 * 根据ID获取房源信息
	 * @param id
	 */
	getHouseRoom(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house_room/get/${id}`,
			method: 'GET'
		})
	},
	/**
	 * 获取房源下房间列表
	 * @param id
	 */
	houseRooms(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/basesearch/house/house_rooms/${id}`,
			method: 'GET'
		})
	},
	/**
	 * 房源搜索
	 * @param data
	 */
	searchByAddress(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/search_by_address',
			data,
			method: 'POST'
		})
	},
	/**
	 * 分散式房源导出
	 * @param data
	 */
	decentralizedHouseExport(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/decentralized_house_export',
			data,
			method: 'POST',
			responseType: 'blob'
		})
	},
	/**
	 * 集中式房源导出
	 * @param data
	 */
	centralizedHouseExport(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/basesearch/house/centralized_house_export',
			data,
			method: 'POST',
			responseType: 'blob'
		})
	},
	// 更新楼盘楼层排序
	updatePropertyFloor(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/update_building_floor_sort',
			data,
			method: 'POST'
		})
	},
	// 更新楼盘楼层号
	updateFloorNumber(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/update_building_floor_no',
			data,
			method: 'POST'
		})
	},
	//修改小区默认房间号规则
	updateDefaultRoomNumber(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/community/set_room_no_rule',
			data,
			method: 'POST'
		})
	},
	// 获取楼盘项目详情
	getItemDetails(id): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/community/${id}`,
			method: 'GET'
		})
	},
	//放房间号生成器
	roomNumberGenerator(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/house/centralized/room_no_generator',
			data,
			method: 'POST'
		})
	},
	// 集中式-分散式房源列表查询
	listingProperties(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/analyser/talented_house/list',
			data,
			method: 'POST'
		})
	},
	// 房源认证统计查询
	propertiesCount(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/analyser/talented_house/house_state',
			data,
			method: 'POST'
		})
	},
	// 认定和批量认定
	recognitionF(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/talented_house/submit',
			data,
			method: 'POST'
		})
	},
	// 根据业务id查询详情（审批列表查询详情）
	getRecognitionDetails(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/talented_house/get_detail',
			data,
			method: 'POST'
		})
	},
	// 取消认定
	cancelRecognitionF(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/workflow/custom/approval/revoke',
			data,
			method: 'POST'
		})
	},
	// 重新认定
	resubmitRecognitionF(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/house/talented_house/resubmit',
			data,
			method: 'POST'
		})
	},
	// 获取房源认证信息
	getPropertyCertification(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/talented_house/get/${id}`,
			method: 'GET'
		})
	},
	// 根据房型id获取认证状态
	getRoomsByRoomTypeId(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house/centralized/get_rooms_by_room_type_id/${id}`,
			method: 'GET'
		})
	}
}
